import React from 'react';
import { useEffect, useState } from 'react';
import './form.scss'

export interface FormItemProps {
    show?: boolean,
    children?: React.ReactNode,
    rule?: string,
    prop?: string,
    label?: string
}

const FormItem = (props: FormItemProps) => {
    // const {show, children, rule, prop, label = ''} = props; 
    const {children, label = ''} = props; 

    const [isShowLabel, setIsShowLabel] = useState<boolean>(true)
    useEffect(() => {
        label ?? setIsShowLabel(false)
    }, [])
    return (
        <div className='hs-ui-form-item'>
            {
                isShowLabel && <div className='hs-ui-form-item__label'>{label}</div>
            }
            <div>{children}</div>
        </div>
    )
}

export default FormItem;